package com.lagou.edu.demo.controller;



import com.lagou.edu.demo.service.IDemoService;
import com.lagou.edu.mvcframework.Annotaions.LagouAutowried;
import com.lagou.edu.mvcframework.Annotaions.LagouController;
import com.lagou.edu.mvcframework.Annotaions.LagouRequestMapping;
import com.lagou.edu.mvcframework.Annotaions.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@LagouController
@LagouRequestMapping("/demo")
@LagouSecurity(value = {"admin"})
public class DemoController {


    @LagouAutowried
    private IDemoService demoService;


    /**
     * URL: /demo/query?name=lisi
     * @param request
     * @param response
     * @param name
     * @return
     */
    @LagouRequestMapping("/query")
    @LagouSecurity(value = {"zhangsan"})
    public String query(HttpServletRequest request, HttpServletResponse response,String name) {
        return demoService.get(name);
    }

    @LagouRequestMapping("/query2")
    public String query2(HttpServletRequest request, HttpServletResponse response,String name) {
        System.out.println("query2 方法");
        return demoService.get(name);
    }

    @LagouRequestMapping("/query3")
    @LagouSecurity(value = {"lisi", "zhangsan"})
    public String query3(HttpServletRequest request, HttpServletResponse response,String name) {
        System.out.println("query3 方法");
        return demoService.get(name);
    }
}
